#include <iostream>
#include <algorithm>
#include <vector>
#define INF 0x7fffffff;
using namespace std;

struct mouse
{
    int weight;
    int speed;
    int order;
} Mouses[1001];

vector<vector<struct mouse>> sequence;

bool cmpbyweight(struct mouse a, struct mouse b)
{
    return a.weight < b.weight;
}

int main()
{
    int weight, speed, i = 1, n;
    bool added;
    int max_length=0, max_element=0;
    vector<struct mouse> tempquene;
    struct mouse tempmouse;
    tempmouse.order = 0;
    tempmouse.speed = INF;
    tempmouse.weight = -1;
    Mouses[0] = tempmouse;
    while (cin >> weight >> speed)
    {
        Mouses[i].weight = weight;
        Mouses[i].speed = speed;
        Mouses[i].order = i;
        i++;
    }
    if (i == 2)
    {
        cout << 1 << endl << 1 << endl;
        exit(0);
    }
    n = i - 1;
    sort(Mouses, Mouses + n+1, cmpbyweight);
    for (i = 1; i <= n; i++)
    {
        added = false;
        for (int j = sequence.size() - 1; j > 0; j--)
        {
            if (sequence[j].back().speed > Mouses[i].speed && sequence[j].back().weight < Mouses[i].weight)
            {
                sequence[j].push_back(Mouses[i]);
                if(sequence[j].size() > max_length)
                {
                    max_length = sequence[j].size();
                    max_element = j;
                }
                added = true;
            }
        }
        if (!added)
        {
            tempquene.clear();
            tempquene.push_back(Mouses[i]);
            sequence.push_back(tempquene);
        }
    }
    cout << max_length << endl;
    for (i = 0; i < max_length; i++)
    {
        cout << sequence[max_element][i].order << endl;
    }
    return 0;
}